//
//  ListAndRegionCollectionViewCell.m
//  DayByDay
//
//  Created by dllo on 16/5/13.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ListAndRegionCollectionViewCell.h"
#import <UIImageView+WebCache.h>

#define CELLWIDTH self.contentView.frame.size.width
#define CELLHEIGHT self.contentView.frame.size.width

@interface ListAndRegionCollectionViewCell ()

@property (nonatomic, strong)UIImageView *imageV;
@property (nonatomic, strong)UILabel *nameLabel;
@property (nonatomic, strong)UILabel *descLabel;
//@property (nonatomic, strong)UIImageView *smallImageV;

@end

@implementation ListAndRegionCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView{
    self.imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 5 / 736.0 * HEIGHT, 120 / 736.0 * HEIGHT, 70 / 736.0 * HEIGHT)];
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(140 / 736.0 * HEIGHT, 10 / 736.0 * HEIGHT, CELLWIDTH - 140 / 736.0 * HEIGHT , 20 / 736.0 * HEIGHT)];
    self.descLabel = [[UILabel alloc] initWithFrame:CGRectMake(130 / 736.0 * HEIGHT, 40 / 736.0 * HEIGHT, CELLWIDTH - 130 / 736.0 * HEIGHT, 20 / 736.0 * HEIGHT)];
//    self.smallImageV = [UIImageView alloc] initWithFrame:CGRectMake(, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>)
//    self.descLabel.numberOfLines = 0;
//    [self.descLabel sizeToFit];
    self.descLabel.numberOfLines = 0;
    [self.contentView addSubview:self.imageV];
    [self.contentView addSubview:self.nameLabel];
    [self.contentView addSubview:self.descLabel];
    self.backgroundColor = [UIColor clearColor];
    self.imageV.backgroundColor = [UIColor clearColor];
    self.nameLabel.backgroundColor = [UIColor clearColor];
    self.descLabel.backgroundColor = [UIColor clearColor];
}

- (void)setModel:(DataModel *)model {
    _model = model;
    [self.imageV sd_setImageWithURL:[NSURL URLWithString:_model.picUrl] placeholderImage:[UIImage imageNamed:@"smiley_26"]];
    self.nameLabel.text = _model.name;
    self.descLabel.text = _model.desc;
    self.descLabel.font = [UIFont systemFontOfSize:14];
    self.descLabel.textColor = [UIColor darkGrayColor];
}


@end
